package mul.UI;

import android.app.Activity;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.WindowManager;

public class GameActivity extends Activity {
	MainGamePanel gamePanel;
	private ListPreference mListPreference;

	
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
		int level =  Integer.parseInt(settings.getString("difficulty", "2"));
		gamePanel = new MainGamePanel(getApplicationContext(), settings.getBoolean("soundOn", true), settings.getBoolean("musicOn", true), level);
		setContentView(gamePanel);
	}
	@Override
	protected void onPause(){
		gamePanel.onPause();
		finish();
		super.onPause();
	}
}
